import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@/views/Home.vue'
import ROUTER_NAMES from '../config/routerName'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/canvas',
    name: 'canvas',
    component: () => import(/* webpackChunkName: "canvas" */ '../views/canvas/Arrow.vue')
  },
  {
    path: '/overflow',
    name: 'Overflow',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "overflow" */ '../views/overFlow'),
    children: [
      {
        path: 'dom',
        name: ROUTER_NAMES.dom,
        component: () => import(/* webpackChunkName: "overflow" */ '@/views/overFlow/Dom.vue')
      },
      {
        path: 'event',
        name: ROUTER_NAMES.event,
        component: () => import(/* webpackChunkName: "overflow" */ '../views/overFlow/Event.vue')
      },
      {
        path: 'interval',
        name: ROUTER_NAMES.interval,
        component: () => import(/* webpackChunkName: "overflow" */ '../views/overFlow/Interval.vue')
      },
      {
        path: 'win',
        name: ROUTER_NAMES.win,
        component: () => import(/* webpackChunkName: "overflow" */ '../views/overFlow/Win.vue')
      },
      {
        path: 'closure',
        name: ROUTER_NAMES.closure,
        component: () => import(/* webpackChunkName: "overflow" */ '../views/overFlow/Closure.vue')
      }
    ]
  },
  {
    path: '/chrome',
    name: 'chrome',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "chrome" */ '../views/chrome/Index.vue'),
    children: [
      {
        path: 'hover',
        name: ROUTER_NAMES.hover,
        component: () => import(/* webpackChunkName: "chrome" */ '../views/chrome/Hover.vue')
      },
      {
        path: 'errorDebugger',
        name: ROUTER_NAMES.errorDebugger,
        component: () => import(/* webpackChunkName: "chrome" */ '../views/chrome/ErrorDebugger.vue')
      }
    ]
  },
  {
    path: '/hoc',
    name: 'hoc',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "chrome" */ '../views/hoc/Parent.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
